﻿using Axiom.CodeManifold.Properties;
using System.IO;

namespace Axiom.CodeManifold.Framework
{
	public static class ReferenceData
	{
		private static Settings _settings = Settings.Default;

		public static string CompanyName
		{
			get
			{
				return Settings.Default.CompanyName;
			}
			set
			{
				Settings.Default.CompanyName = value;
				Settings.Default.Save();
			}
		}

		public static string DomainModelProjectName
		{
			get
			{
				return Settings.Default.DomainModelProjectName;
			}
			set
			{
				Settings.Default.DomainModelProjectName = value;
				Settings.Default.Save();
			}
		}

		public static int RegionMinSize
		{
			get
			{
				return Settings.Default.Sort_RegionMinSize;
			}
			set
			{
				Settings.Default.Sort_RegionMinSize = value;
				Settings.Default.Save();
			}
		}

		public static string RelativeSolutionPath
		{
			get
			{
				return Settings.Default.RelativeSolutionPath;
			}
			set
			{
				Settings.Default.RelativeSolutionPath = value;
				Settings.Default.Save();
			}
		}

		public static string RootFolder
		{
			get
			{
				return Settings.Default.RootFolder;
			}
			set
			{
				Settings.Default.RootFolder = value;
				Settings.Default.Save();
			}
		}

		public static Settings Settings
		{
			get { return ReferenceData._settings; }
			set { ReferenceData._settings = value; }
		}

		public static string SoftwareLicenseUrl
		{
			get
			{
				return Settings.Default.SoftwareLicenseUrl;
			}
			set
			{
				Settings.Default.SoftwareLicenseUrl = value;
				Settings.Default.Save();
			}
		}

		public static string SolutionFullName
		{
			get
			{
				return Path.Combine(RootFolder, RelativeSolutionPath);
			}
		}

		public static bool UseRegions
		{
			get
			{
				return Settings.Default.UseRegions;
			}
			set
			{
				Settings.Default.UseRegions = value;
				Settings.Default.Save();
			}
		}

		public static bool UseUndoContext
		{
			get
			{
				return Settings.Default.UseUndoContext;
			}
			set
			{
				Settings.Default.UseUndoContext = value;
				Settings.Default.Save();
			}
		}
	}
}
